home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-16 | 9.2 KB | 369 lines | [TEXT/KAHL] |
- /******************************************************************************
- x_CAbout.cp
-
- CAbout Dialog Director Class
-
- Copyright © 1996 Dan Crevier. All rights reserved.
-
- Generated by Visual Architectâ„¢
-
- This file is rewritten each time you generate code. You should not
- make changes to this file; changes should go in the CAbout.cp
- file, instead.
-
- If you want to change how Visual Architect generates this file, you can
- change the template for this file. It is "_Dialog_cp" in the Visual Architect
- Templates folder.
-
- ******************************************************************************/
-
- #include "x_CAbout.h"
-
- #include "AboutItems.h"
-
- #include "ViewUtilities.h"
-
- #include <CIntegerText.h>
- #include <Commands.h>
- #include <CControl.h>
- #include <CPopupMenu.h>
- #include <CPopupPane.h>
- #include <CArrayPane.h>
- #include <CIconButton.h>
- #include <CPictureButton.h>
- #include <CSwissArmyButton.h>
-
- #include "CStaticText.h"
- #include "CButton.h"
-
-
- #include <CApplication.h>
- #include <CBartender.h>
- #include <Commands.h>
- #include <Constants.h>
- #include <CDecorator.h>
- #include <CDesktop.h>
- #include <CDirectorOwner.h>
- #include <CFile.h>
- #include <CList.h>
- #include <CPanorama.h>
- #include <TBUtilities.h>
- #include <CWindow.h>
-
- extern CApplication *gApplication; /* The application */
- extern CDecorator *gDecorator; /* Decorator for arranging windows */
- extern CDesktop *gDesktop; /* The visible Desktop */
- extern CBartender *gBartender; /* Manages all menus */
-
- // Define symbols for commands handled by this class
- // Prevents a recompile every time any command changed.
-
-
- TCL_DEFINE_CLASS_M1(x_CAbout, CDialogDirector);
-
- /**** C O N S T R U C T I O N / D E S T R U C T I O N M E T H O D S ****/
-
-
- /******************************************************************************
- Ix_CAbout
-
- Initialize the dialog
- ******************************************************************************/
-
- void x_CAbout::Ix_CAbout(CDirectorOwner *aSupervisor, Boolean push)
-
- {
- IDialogDirector(aSupervisor);
-
- // There are several circumstances where we don't want
- // ProviderChanged to be called. During initialization,
- // during calls to UpdateData, etc. The ignore flag
- // heads these off.
-
- ignore = TRUE; /* Don't call UpdateData now */
-
- MakeNewWindow(); /* Create the dialog's window */
-
- DoBeginData(push); /* Gather initial values */
-
- ignore = FALSE;
- }
-
-
- /******************************************************************************
- MakeNewWindow
-
- Create a window by reading a view resource
- ******************************************************************************/
-
- void x_CAbout::MakeNewWindow(void)
-
- {
- itsWindow = TCLGetNamedWindow("\pAbout", this);
-
- // Initialize pointers to the subpanes in the window
-
- fAbout_Stat1 = (CStaticText*) FindPane(kAbout_Stat1ID);
- ASSERT(member(fAbout_Stat1, CStaticText));
-
- fAbout_Butn2 = (CButton*) FindPane(kAbout_Butn2ID);
- ASSERT(member(fAbout_Butn2, CButton));
-
- fAbout_Stat3 = (CStaticText*) FindPane(kAbout_Stat3ID);
- ASSERT(member(fAbout_Stat3, CStaticText));
-
- fAbout_Stat5 = (CStaticText*) FindPane(kAbout_Stat5ID);
- ASSERT(member(fAbout_Stat5, CStaticText));
-
- }
-
-
- /******************************************************************************
- FindPane
-
- Locate a subpane of this window by ID. Note that Visual Architect-
- generated IDs are unique within a project, so this function
- will find panes within subviews, even if dynamically loaded.
- ******************************************************************************/
-
- CPane *x_CAbout::FindPane(long ID)
-
- {
- return (CPane*) itsWindow->FindViewByID(ID);
- }
-
-
- /******************************************************************************
- DoBeginData
-
- Collect initial values from subclass and initialize panes
- ******************************************************************************/
-
- void x_CAbout::DoBeginData(Boolean push)
-
- {
- CAboutData data = {0}; /* The initial value record */
-
- BeginData(&data); // Ask subclass for initial values
-
- if (!push)
- {
- DispensePaneValues(data); // Set panes
- }
-
- // Save the initial values in case user cancels
-
- saveData = data;
- }
-
-
- /******************************************************************************
- DoEndData
-
- Collect final values from panes and tell subclass.
- During EndData(), data argument has current values and
- saveData has initial values. After EndData(), saveData
- holds current values.
- ******************************************************************************/
-
- void x_CAbout::DoEndData(long theCommand)
-
- {
- CAboutData data; /* The initial value record */
- RgnHandle rgn; /* Selection region */
-
- /* If user canceled the dialog, */
- if (theCommand == cmdCancel) /* return the initial values */
- {
- data = saveData;
- }
- else
- CollectPaneValues(data); // Get current pane values
-
- EndData(&data); // Tell the derived class
-
- saveData = data; // Now has current values
- }
-
-
- /******************************************************************************
- SetData
-
- Set initial values of panes. Must be called after I-function. (2.0.5)
- ******************************************************************************/
-
- void x_CAbout::SetData(const CAboutData& initial)
- {
- DispensePaneValues(initial);
- saveData = initial;
- }
-
-
- /******************************************************************************
- GetData
-
- Collect final values from panes. Must be called after DoEndData
- (which means it is usually only meaningful for modal dialogs,
- as modeless dialogs usually call DoEndData during Close()). (2.0.5)
- ******************************************************************************/
-
- void x_CAbout::GetData(CAboutData& final)
- {
- final = saveData;
- }
-
-
- /******************************************************************************
- DispensePaneValues
-
- Set pane values from argument struct
- ******************************************************************************/
-
- void x_CAbout::DispensePaneValues(const CAboutData& data)
-
- {
- // Initialize the panes based on the values supplied.
- // The ASSERT statements ensure that the generated
- // code is in synch with the view resource.
-
- }
-
- /******************************************************************************
- CollectPaneValues
-
- Collect final values from panes and tell subclass
- ******************************************************************************/
-
- void x_CAbout::CollectPaneValues(CAboutData& data)
-
- {
- RgnHandle rgn; /* Selection region */
-
- /* Collect values from panes */
- }
-
-
- /******************************************************************************
- BeginData
-
- Collect initial values from subclass and initialize panes.
- The default function does nothing.
- ******************************************************************************/
-
- void x_CAbout::BeginData(CAboutData *initial)
-
- {
- }
-
-
- /******************************************************************************
- UpdateData
-
- Tell subclass when panes change
- ******************************************************************************/
-
- void x_CAbout::UpdateData(CAboutUpdate *update, long itemNo)
-
- {
- }
-
-
- /******************************************************************************
- EndData
-
- Tell subclass the final values. For a canceled modal dialog,
- these are the same as the initial values.
- ******************************************************************************/
-
- void x_CAbout::EndData(CAboutData *final)
-
- {
- }
-
-
- /******************************************************************************
- DoModalDialog {OVERRIDE}
-
- Override to call EndData
- ******************************************************************************/
-
- long x_CAbout::DoModalDialog(long defaultCmd)
-
- {
- long result = CDialogDirector::DoModalDialog(defaultCmd);
-
- DoEndData(result);
- return result;
- }
-
-
- /******************************************************************************
- Close {OVERRIDE}
-
- Override to call EndData
- ******************************************************************************/
-
- Boolean x_CAbout::Close(Boolean quitting)
-
- {
- if (itsWindow && !itsWindow->active)
- itsWindow->Select();
-
- if (EndDialog(cmdOK, TRUE))
- {
- /* For a modal dialog, exit through */
- if (itsWindow->IsModal()) /* DoModalDialog */
- {
- dismissCmd = cmdClose;
- return TRUE;
- }
- else
- {
- /* Collect final values and call */
- DoEndData(cmdOK); /* EndData */
- /* Do the Close, skipping */
- /* CDialogDirector (7.0.4) */
- return CDirector::Close(quitting);
- }
- }
- else
- return FALSE;
- }
-
-
- /******************************************************************************
- ProviderChanged {OVERRIDE}
-
- User did something. Note that the TCL
- does not currently report changes to plain CEditText items.
- ******************************************************************************/
-
- void x_CAbout::ProviderChanged(CCollaborator *aProvider, long reason, void* info)
-
- {
- CAboutUpdate data; /* The update value record */
- Str255 str;
- Boolean saveIgnore = ignore;
-
- if (ignore) /* Don't be a chatterbox */
- return;
- ignore = TRUE;
-
- try_
- {
- if (FALSE) {}
- else
- CDialogDirector::ProviderChanged(aProvider, reason, info);
- }
- catch_all_()
- {
- ignore = saveIgnore;
- throw_same_();
- }
- end_try_
-
- ignore = saveIgnore; /* ProviderChanged() can't Close()! */
- }
-
-
-